<?php
#
# author: Phil Spagnolo
# (c)2008 South Hill Calvary Chapel
#

$linkList = array("childrens_ministry.php", "shcc-cm-parents.php", "shcc-cm.php");
$textList = array("Children's Ministry", "Parent Connections", "Teacher Resources");

include_once("./root.inc.php");
include_once("${root}/common.php");
include("${root}/mysql/common.php");
include("${root}/mysql/database_info.php");

$day = $_GET['day'];
if (!(isset($_GET['day']) && ($day == 'Sun' || $day == 'Wed' || $day =='Sat'))) {
    die ("Error:  Bad input '$day' must be Sat, Sun, or Wed");
}

if ($day == Sun) {
	$title = "Archived Sunday Parent Connections";
	$meta_key='Sunday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	print_html_head($title ,$meta_key,$meta_desc);
	print_java_head(NULL);
	begin_body();
	page_title($title);
  in_page_link(3, false, $linkList, $textList, "");

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day='Sunday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  cm_pc_table($result,$num_rows, false, 'Sunday');
} else if ($day == Sat) {
	$title = "Archived Saturday Parent Connections";
	$meta_key='Saturday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	print_html_head($title ,$meta_key,$meta_desc);
	print_java_head(NULL);
	begin_body();
	page_title($title);
  in_page_link(3, false, $linkList, $textList, "");

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day='Saturday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  cm_pc_table($result,$num_rows, false, 'Saturday');
} else {
	$title = "Archived Wednesday Thru the Bible Parent Connections";
	$meta_key='Wednesday, archived, parent, family, mom, dad, gaurdian, connecting, connection, newsletter, children, kids, bible, craft, game, worship, sunday, school, jesus';
	$meta_desc="The Parent Connections are to used by parents to stay connected with CM at South Hill Calvary Chapel.";
	print_html_head($title ,$meta_key,$meta_desc);
	print_java_head(NULL);
	begin_body();
	page_title($title);
  in_page_link(3, false, $linkList, $textList, "");

  $table = "cm-pc";
  connect_select_test($table);
  $query="SELECT * FROM `$table` WHERE day ='Wednesday' ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  cm_wed_table($result,$num_rows);
}


in_page_link(3, false, $linkList, $textList, "");
end_page_title();
end_body();
//Close the database
mysql_close();
?>
